<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript">
		$(function() {
			$('#text_contact-date-begin').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#text_contact-date-end').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
		});
		</script>

		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		
		<script type="text/javascript">
		$(function() {
			// メッセージのフェード
			$('.message').fadeIn("slow");

			// 戻るボタン押下
			$('#btn_back').click(function(){
				document.fm.mode.value = 'back';
				document.fm.submit();
			});

			// 削除ボタン押下
			$('#btn_del').click(function(){
				if( confirm('削除してよろしいですか？') ){
					document.fm.mode.value = 'delete';
					document.fm.submit();
				}
			});
		});

		</script>

	</head>
	<body id="">
{{ php }} include( MENU_FILE ); {{ /php }}
		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>
		<div id="container"><div class="wrapper">

			<h2>サイト管理</h2>
			<ul class="submenu clearfix">
				<li><a href="news_index.php">一覧</a></li>
				<li><span>プレスリリース登録</span></li>
				<li><a href="news_form.php">ニュース登録</a></li>
			</ul>

			<h3>{{ $title }}</h3>
{{ if $phase == 'input' }}
			<p class="message">登録内容を確認し、確認ボタンをクリックしてください。</p>
			
			<form name="fm" action="press_form.php" method="post">
				<input type="hidden" name="mode" value="input" />
				<table class="formTable">
					<tbody>
{{ if $forms.news_id != '' }}
						<tr>
							<th>登録日</th>
							<td>
								{{ $forms.r_date }}
							</td>
						</tr>

						<tr>
							<th>更新日</th>
							<td>
								{{ $forms.u_date }}
							</td>
						</tr>

						<tr>
							<th>ID</th>
							<td>
								{{ $forms.news_id }}
							</td>
						</tr>
{{ /if }}
						<tr>
							<th>※ステータス</th>
							<td>
{{ html_radios name='status' options=$select_status selected=$forms.status separator='&nbsp;' }}
							</td>
						</tr>

						<tr>
							<th>※タイトル</th>
							<td>{{ $err.news_title }}
								<textarea name="news_title" rows="2" cols="80">{{ $forms.news_title|escape }}</textarea>
							</td>
						</tr>

						<tr>
							<th>アイコン</th>
							<td>
								<label><input type="checkbox" name="icon1" value="1"{{ if $forms.icon1 == '1' }} checked{{ /if }} />新商品発売</label><br />
								<label><input type="checkbox" name="icon2" value="1"{{ if $forms.icon2 == '1' }} checked{{ /if }} />新サービス開始</label><br />
								<label><input type="checkbox" name="icon3" value="1"{{ if $forms.icon3 == '1' }} checked{{ /if }} />商品リニューアル</label>
							</td>
						</tr>

						<tr>
							<th>※日付</th>
							<td>
								<input type="text" name="news_date" id="text_contact-date-begin" value="{{ $forms.news_date }}" class="text" />
								{{ $err.news_date }}
							</td>
						</tr>

						<tr>
							<th>※内容</th>
							<td>{{ $err.news_text }}<textarea name="news_text" class="mce_edit">{{ $forms.news_text }}</textarea></td>
						</tr>

					</tbody>
				</table>

				<p class="button">
{{ if $forms.news_id != '' }}
					<button type="button" id="btn_del"><span>削除</span></button>
{{ /if }}
					<button type="reset"><span>リセット</span></button>
					<button type="submit" class="submit"><span>確認</span></button>
				</p>
				<input type="hidden" name="news_id" value="{{ $forms.news_id }}" />
				<input type="hidden" name="phase" value="confirm" />
			</form>
{{ /if }}

{{ $default_modifiers }}

{{ if $phase == 'confirm' }}
			<p class="message">この内容で登録します。よろしいですか？</p>
			
			<form name="fm" action="press_form.php" method="post">
				<input type="hidden" name="mode" value="confirm" />
				<table class="formTable">
					<tbody>
						<tr>
							<th>ステータス</th>
							<td>
								{{ $select_status[$forms.status] }}<input type="hidden" name="status" value="{{ $forms.status }}" />
							</td>
						</tr>

						<tr>
							<th>タイトル</th>
							<td>
								{{ $forms.news_title|escape|nl2br }}<input type="hidden" name="news_title" value="{{ $forms.news_title }}" />
							</td>
						</tr>

						<tr>
							<th>アイコン</th>
							<td>
								{{ if $forms.icon1 == 1 }}新商品発売<input type="hidden" name="icon1" value="1" />{{ /if }}
								{{ if $forms.icon2 == 1 }}新サービス開始<input type="hidden" name="icon2" value="1" />{{ /if }}
								{{ if $forms.icon3 == '1' }}商品リニューアル<input type="hidden" name="icon3" value="1" />{{ /if }}
							</td>
						</tr>

						<tr>
							<th>日付</th>
							<td>
								{{ $forms.news_date|escape }}<input type="hidden" name="news_date" value="{{ $forms.news_date }}" />
							</td>
						</tr>

						<tr>
							<th>内容</th>
							<td>
								{{ $forms.news_text }}<input type="hidden" name="news_text" value="{{ $forms.news_text|escape }}" />
							</td>
						</tr>

					</tbody>
				</table>

				<p class="button">

					<button type="button" id="btn_back"><span>戻る</span></button>
					<button type="submit" class="submit"><span>{{ if $forms.news_id == '' }}登録{{ else }}更新{{ /if }}</span></button>

				</p>

				<input type="hidden" name="news_id" value="{{ $forms.news_id }}" />
				<input type="hidden" name="phase" value="confirm" />
				<input type="hidden" name="tran_id" value="{{ $tran_id }}" />
			</form>
{{ /if }}


{{ if $phase == 'complete' }}
			<p class="message">{{ $message }}</p>
{{ /if }}

		</div></div>
		<address>Copyright (C) SHIFT Inc. / All rightes reserved</address>
	</body>
</html>